<?php
/**
 * Search.php
 * Created by PhpStorm.
 * User: 江小波
 * Date: 2019/06/14
 * Time: 08:55
 */
namespace app\api\open\store;

use app\api\open\Base;
use app\api\model\StoreModel;
use app\common\Singleton;

class Search extends Base
{
    protected $where = [];

    public function __construct($param = [])
    {
        $this->prevent();

        parent::__construct($param);

		// 是否启用（0否，1是）
		if(isset($this->params['is_enable']) && $this->params['is_enable']!='')
		{
			$this->where['is_enable'] = $this->params['is_enable'];
		}
		// 名称
		if(isset($this->params['name']) && $this->params['name']!='')
		{
			$this->where['name'] = $this->params['name'];
		}
		// logo图标
		if(isset($this->params['logo']) && $this->params['logo']!='')
		{
			$this->where['logo'] = $this->params['logo'];
		}
    }
    
    /**
     * @param array $param
     * @return array|false|null|\PDOStatement|string|\think\Model
     * @throws \Exception
     */
    public function index($param=[])
    {
        // 获取列表
        return StoreModel::getInstance()->getList($this->where,[
            'field'=> '*'
        ]);
    }
}